cmake_minimum_required(VERSION 3.22)


set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

project(Tutorial LANGUAGES CXX)

set(Common_DIR ${CMAKE_SOURCE_DIR}/sample/Common)
set(Interface_DIR ${CMAKE_SOURCE_DIR}/sample/Interface)


find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED)
find_package(OpenCASCADE REQUIRED)
file(GLOB_RECURSE Common_SRC ${Common_DIR}/*.cpp)
file(GLOB_RECURSE Interface_SRC ${Interface_DIR}/*.cpp)
file(GLOB_RECURSE CPP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
list(APPEND CPP_SRC ${Common_SRC} ${Interface_SRC})


include_directories(${Common_DIR})
include_directories(${Interface_DIR})

file(GLOB_RECURSE Common_TS ${Common_DIR}/*.ts)
file(GLOB_RECURSE Interface_TS ${Interface_DIR}/*.ts)
file(GLOB_RECURSE Tutorial_TS ${CMAKE_CURRENT_SOURCE_DIR}/*.ts)
list(APPEND TS_FILES ${Common_TS} ${Interface_TS} ${Tutorial_TS})

set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION $ENV{CSF_RESOURCESDEFAULTS})
qt5_add_translation(QM_FILES ${TS_FILES})
message(${QM_FILES})
add_executable(${PROJECT_NAME}
  ${CPP_SRC}
  ${QM_FILES}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    ${OpenCASCADE_LIBRARIES}
    Qt5::Widgets)
